From: Florian Müllner Date: Thu, 27 Nov 2025 13:43:43 +0000 (+0100) Subject: test-tool: Set up a temporary xdg-home directory X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~72 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=17afe4411f7547f54ee04c1912aa72c7df2e2154;p=gnome-shell.git test-tool: Set up a temporary xdg-home directory Currently the launched gnome-shell instance uses the regular xdg-home directories, which means it picks up settings, extensions etc. from the current user. Avoid this by pointing the xdg-home dirs to a temporary directory, so everything that respects the basedir spec runs with a clean slate. Part-of: --- diff --git a/src/gnome-shell-test-tool.in b/src/gnome-shell-test-tool.in index 74d4c1461..35380da66 100755 --- a/src/gnome-shell-test-tool.in +++ b/src/gnome-shell-test-tool.in @@ -16,13 +16,17 @@ def show_version(option, opt_str, value, parser): print("GNOME Shell Test Tool @VERSION@") sys.exit() -def start_shell(wrap=None, perf_output=None): +def start_shell(xdg_home, wrap=None, perf_output=None): # Set up environment env = dict(os.environ) filters = ['Gnome-shell-perf-helper'] + options.extra_filter env['MUTTER_WM_CLASS_FILTER'] = ','.join(filters) + env['XDG_CACHE_HOME'] = f'{xdg_home}/cache' + env['XDG_CONFIG_HOME'] = f'{xdg_home}/config' + env['XDG_DATA_HOME'] = f'{xdg_home}/data' + if perf_output is not None: env['SHELL_PERF_OUTPUT'] = perf_output @@ -58,13 +62,14 @@ def start_shell(wrap=None, perf_output=None): return subprocess.Popen(args, env=env) def run_shell(wrap=None, perf_output=None): - # we do no additional supervision of gnome-shell, - # beyond that of wait - # in particular, we don't kill the shell upon - # receiving a KeyboardInterrupt, as we expect to be - # in the same process group - shell = start_shell(wrap=wrap, perf_output=perf_output) - shell.wait() + with tempfile.TemporaryDirectory() as xdg_home: + # we do no additional supervision of gnome-shell, + # beyond that of wait + # in particular, we don't kill the shell upon + # receiving a KeyboardInterrupt, as we expect to be + # in the same process group + shell = start_shell(xdg_home=xdg_home, wrap=wrap, perf_output=perf_output) + shell.wait() return shell.returncode == 0 def gnome_hwtest_log(*args):